import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '首页',
      component: HomeView,
      meta:{
        period:true
      }
    },
    {
      path: '/index',
      name: '评价指数',
      component: ()=>import('@/views/IndexView.vue'),
      meta:{
        period:true
      }
    },
    {
      path: '/activity/:id',
      name: '党建活动',
      component: ()=>import('@/views/ActivityView.vue')
    },
    {
      path: '/admin',
      name:'后台管理',
      component:()=>import('@/views/AdminView.vue'),
      redirect:'/admin/center',
      children:[
        {
          path:'center',
          name:'管理中心',
          components:{
            admin:()=>import('@/views/admin/AdminCenterView.vue')
          }
        },
        {
          path: 'meta_rate',
          name:'评价细则',
          components:{
            admin:()=>import('@/views/admin/MetaRateView.vue')
          }
        },
        {
          path:'meta_organization',
          name:'单位信息管理',
          components:{
            admin:()=>import('@/views/admin/MetaOrganizationView.vue')
          }
        },
        {
          path:'rate',
          name:'评分系统',
          components:{
            admin:()=>import('@/views/admin/RateView.vue')
          }
        }
      ]
    }
  ]
})

export default router
